package model.entity.role;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "PageTask")
public class PageTask {

	private int taskId;
	private PageFunction pageFunction;
	private GroupRole groupRole;
	private String taskName;
	private String commandLink;

	public PageTask() {
	}

	public PageTask(PageFunction pageFunction, GroupRole groupRole,
			String taskName, String commandLink) {
		this.pageFunction = pageFunction;
		this.groupRole = groupRole;
		this.taskName = taskName;
		this.commandLink = commandLink;
	}

	@Id
	@GeneratedValue(generator = "PageTask_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "PageTask_ID_Gen", sequenceName = "PageTask_SEQ_ID")
	@Column(name = "TaskID", unique = true, nullable = false)
	public int getTaskId() {
		return this.taskId;
	}

	public void setTaskId(int taskId) {
		this.taskId = taskId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FunctionID", nullable = false)
	public PageFunction getPageFunction() {
		return this.pageFunction;
	}

	public void setPageFunction(PageFunction pageFunction) {
		this.pageFunction = pageFunction;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RoleID", nullable = false)
	public GroupRole getGroupRole() {
		return this.groupRole;
	}

	public void setGroupRole(GroupRole groupRole) {
		this.groupRole = groupRole;
	}

	@Column(name = "TaskName", nullable = false)
	public String getTaskName() {
		return this.taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}

	@Column(name = "CommandLink", nullable = false)
	public String getCommandLink() {
		return this.commandLink;
	}

	public void setCommandLink(String commandLink) {
		this.commandLink = commandLink;
	}

}
